home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
batch
/
bkdr10
/
backdoor.asm
next >
Wrap
Assembly Source File
|
1991-11-10
|
3KB
|
93 lines
TITLE BACKDOOR.COM
COMMENT |
Program BACKDOOR version 1.0 by Duane Paulson 11/11/91.
Purpose: Batch file enhancer. Provides a two second pause during which
a user can break out of a batch file configured as an endless
loop.
Call: BACKDOOR
Returns: DOS Errorlevel 0 if program terminated without a keypress;
DOS Errorlevel 255 if user pressed a key.
Assemble: MASM BACKDOOR;
Link: LINK BACKDOOR;
EXE2BIN BACKDOOR BACKDOOR.COM
Assembler: MASM 5.1
|
;-------------------------------------------------------------------------------
program SEGMENT 'CODE'
ORG 100h
ASSUME CS:program,DS:program,ES:program,SS:program
;-- Code -----------------------------------------------------------------------
main PROC NEAR
start: mov ah,9 ; display opening message
mov dx,OFFSET open_msg
int 21h ; call dos
mov ah,0 ; get system timer
int 01Ah ; call bios
add dx,40 ; add 40 to low word (timer ticks 18
; times/sec) for approx. 2 sec. pause
mov low_word,dx ; store low word
waitloop: mov ah,0Bh ; check for character waiting
int 21h ; call dos
cmp al,0FFh ; character waiting?
je key_hit ; then exit
mov ah,0 ; get system timer
int 01Ah ; call bios
cmp dx,low_word ; compare low word to low_timer
jb waitloop ; loop until timer catches up.
mov ah,9 ; overwrite opening message
mov dx,OFFSET close_msg
int 21h ; call dos
mov ax,4C00h ; normal exit -- no key was pressed
int 21h ; exit with 0 exit code (errorlevel)
;-------------------------------------------------------------------------------
COMMENT |
If a key is hit, the following routine comes into play. First the program
swallows the keystroke without echoing it, then makes sure that the keyboard
buffer is empty. (Extended keys such as F-keys, PgUp, and End place 2 bytes in
keyboard buffer.) Program then exits with 255 errorlevel.
|
key_hit: mov ah,7 ; Character input without echo
int 21h ; call dos
mov ah,0Bh ; check for another character waiting
int 21h ; call dos
cmp al,0FFh ; another character waiting?
je key_hit ; then loop
mov ah,9 ; overwrite opening message
mov dx,OFFSET close_msg
int 21h ; call dos
mov ax,4CFFh ; exit after key is hit
int 21h ; exit with 255 exit code (errorlevel)
main ENDP
;-- Data ---------------------------------------------------------------------
program_name DB "BACKDOOR.COM version 1.0 by Duane Paulson 11/11/91"
low_word DW ? ; low word of system timer
open_msg DB "Backdoor (1.0) is open...$"
close_msg DB 25 DUP (8,32,8),'$' ; 25 backspaces to overwrite
; opening message.
program ENDS
END start